package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.IntegrationChannel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by DK on 16/12/17.
 */
@Repository
public interface IntegrationChannelRepository extends JpaRepository<IntegrationChannel, Long>, JpaSpecificationExecutor, IntegrationChannelRepositoryCustom {
    List<IntegrationChannel> findByMallIdAndIsDelete(Long mallID, Whether no);

    IntegrationChannel findByIdAndMallIdAndIsDelete(Long channelId, Long mallId, Whether no);

    IntegrationChannel findByAppKeyAndIsDelete(String appKey, Whether no);

    IntegrationChannel findByIdAndIsDelete(Long id, Whether no);

    IntegrationChannel findByAppKeyAndAppSecretAndIsDelete(String appKey, String appSecret, Whether no);

    IntegrationChannel findTop1ByName(String name);
}
